package com.kd.crawler.dao.crawler;

import java.util.Date;

import com.kd.crawler.common.utils.MD5Util;
import com.kd.crawler.dao.BaseDao;

public class CrawlerUrlMD5Dao extends BaseDao {

	private static final CrawlerUrlMD5Dao dumDao = new CrawlerUrlMD5Dao();
	
	private CrawlerUrlMD5Dao() {
		
	}
	
	public static CrawlerUrlMD5Dao getInstance() {
		return dumDao;
	}
	
	public long insert(String md5) {
		String sql = "insert into crawler_urlmd5 values(?, ?)";
		try {
			return this.update(sql, md5,new Date());
		} catch (Exception e) {
//			e.printStackTrace();
			return -1;
		}
	}
	
	public static void main(String[] args) {
		String link = "http://ws.wzsee.com/shdt/";
		long result = CrawlerUrlMD5Dao.getInstance().insert(MD5Util.MD5(link));
		System.out.println("result: " + result);
	}
}
